﻿<!--#include file="../lib/base.asp"-->
<!--#include file="../theme.asp"-->
<%
sdcms.checkuserlogin
dim act:act=lcase(sdcms.fget("act",0))
dim apikey:apikey=lcase(sdcms.fget("apikey",0))
dim userdata:userdata=sdcms.userinfo
dim userid:userid=userdata(0)
select case act
	case "ubound":checkdb(apikey)
	case else
		dim binddata:binddata=sdcms.db.dbload("","opentype","sd_user_bind","userid="&userid&"","")
		dim bindarr:bindarr=""
		if ubound(binddata)>=0 then
			dim i
			for i=0 to ubound(binddata,2)
				if bindarr="" then
					bindarr=binddata(0,i)
				else
					bindarr=bindarr&","&binddata(0,i)
				end if
			next
		end if
		sdcms.show theme_userbind,""
end select

sub checkdb(byval t0)
	if sdcms.db.dbcount("sd_user_bind","userid="&userid&" and opentype='"&t0&"'")>0 then
		sdcms.db.dbdel "sd_user_bind","userid="&userid&" and opentype='"&t0&"'"
		sdcms.echo "1"
	else
		sdcms.echo "0"
	end if
end sub
sdcms.db.dbclose
%>